home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gnu / adainc / s-tasclo.ads < prev    next >
Text File  |  1996-01-30  |  4KB  |  99 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                 GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS               --
  4. --                                                                          --
  5. --                     S Y S T E M . T A S K _ C L O C K                    --
  6. --                                                                          --
  7. --                                  S p e c                                 --
  8. --                                                                          --
  9. --                             $Revision: 1.10 $                             --
  10. --                                                                          --
  11. --       Copyright (c) 1991,1992,1993,1994, FSU, All Rights Reserved        --
  12. --                                                                          --
  13. -- GNARL is free software; you can redistribute it  and/or modify it  under --
  14. -- terms  of  the  GNU  Library General Public License  as published by the --
  15. -- Free Software  Foundation;  either version 2, or (at  your  option)  any --
  16. -- later  version.  GNARL is distributed  in the hope that  it will be use- --
  17. -- ful, but but WITHOUT ANY WARRANTY;  without even the implied warranty of --
  18. -- MERCHANTABILITY  or  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Gen- --
  19. -- eral Library Public License  for more details.  You should have received --
  20. -- a  copy of the GNU Library General Public License along with GNARL;  see --
  21. -- file COPYING.LIB.  If not,  write to the  Free Software Foundation,  675 --
  22. -- Mass Ave, Cambridge, MA 02139, USA.                                      --
  23. --                                                                          --
  24. ------------------------------------------------------------------------------
  25.  
  26. --  This package interfaces with the Ada RTS and defines the low-level
  27. --  timer operations.
  28.  
  29. package System.Task_Clock is
  30.  
  31.    type Stimespec is private;
  32.  
  33.    Stimespec_First : constant Stimespec;
  34.  
  35.    Stimespec_Last  : constant Stimespec;
  36.  
  37.    Stimespec_Zero  : constant Stimespec;
  38.  
  39.    Stimespec_Unit  : constant Stimespec;
  40.  
  41.    Stimespec_Sec_Unit : constant Stimespec;
  42.  
  43.    function Stimespec_Seconds (TV : Stimespec) return Integer;
  44.  
  45.    function Stimespec_NSeconds (TV : Stimespec) return Integer;
  46.  
  47.    function Time_Of (S, NS : Integer) return Stimespec;
  48.  
  49.    function Stimespec_To_Duration (TV : Stimespec) return Duration;
  50.  
  51.    function Duration_To_Stimespec (Time : Duration) return Stimespec;
  52.  
  53.    function "-"  (TV : Stimespec) return Stimespec;
  54.  
  55.    function "+"  (LTV, RTV : Stimespec) return Stimespec;
  56.  
  57.    function "-"  (LTV, RTV : Stimespec) return Stimespec;
  58.  
  59.    function "*" (TV : Stimespec; N : Integer) return Stimespec;
  60.  
  61.    function "/" (TV : Stimespec; N : integer) return Stimespec;
  62.  
  63.    function "/" (LTV, RTV : Stimespec) return Integer;
  64.  
  65.    function "<"  (LTV, RTV : Stimespec) return Boolean;
  66.  
  67.    function "<=" (LTV, RTV : Stimespec) return Boolean;
  68.  
  69.    function ">"  (LTV, RTV : Stimespec) return Boolean;
  70.  
  71.    function ">=" (LTV, RTV : Stimespec) return Boolean;
  72.  
  73. private
  74.  
  75.    --  Stimespec is represented in 64-bit Integer. It represents seconds and
  76.    --  nanoseconds together and is symmetric around Zero.
  77.    --  For example, 1 second and 1 nanosecond is represented as "100000001"
  78.  
  79.    subtype Time_Base is Long_Long_Integer range -Long_Long_Integer'Last ..
  80.      Long_Long_Integer'Last;
  81.  
  82.    type Stimespec is record
  83.       Val : Time_Base;
  84.    end record;
  85.  
  86.    Stimespec_First : constant Stimespec :=
  87.      Stimespec' (Val => -Long_Long_Integer'Last);
  88.  
  89.    Stimespec_Last : constant Stimespec :=
  90.      Stimespec' (Val => Long_Long_Integer'Last);
  91.  
  92.    Stimespec_Zero : constant Stimespec := Stimespec' (Val => 0);
  93.  
  94.    Stimespec_Unit : constant Stimespec := Stimespec' (Val => 1);
  95.  
  96.    Stimespec_Sec_Unit : constant Stimespec := Stimespec' (Val => 10#1#E9);
  97.  
  98. end System.Task_Clock;
  99.